home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
comm
/
prcm243u.zip
/
PCP-MENU.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1986-09-21
|
14KB
|
443 lines
;*********************************************************************
;
; ProComm 2.4 Command file to dial PC Pursuit numbers. Demonstrates
; menu building, branching on user input, etc. Please note that only
; three cities are implemented in this demo.
;
; String variables are used extensively here. Their uses are:
;
; S0 - holds user input for SWITCHing
; S1 - holds PCP city name
; S2 - holds PCP city area code
; S3 - holds final destination name
; S4 - holds final destination phone number
; S5 - holds user input for SWITCHing
; S6 - you must set to modem dial command and local TELENET number
; S7 - you must set to apporpriate baud rate (3 or 12)
; S8 - you must set to your PCP user id
; S9 - you must set to your PCP password
;
;*********************************************************************
; Customization area - you need to change these for your setup
ASSIGN S9 "12" ; Enter the baudrate to use here, 3 or 12
ASSIGN S8 "xxxxxxx" ; Enter the id to be used here
ASSIGN S7 "xxxxxxxx" ; Enter the password to be used here
ASSIGN S6 "ATDTxxx-xxxx!" ; Enter dial cmd and local telenet # here
SET CR_IN CR ; make sure no extra LF's in menus
CLEAR ; clear the screen
LOCATE 1,0 ; position the cursor
; Build the first menu
MESSAGE " ┌┤ PC PURSUIT AVAILABLE CITIES ├┐"
MESSAGE " │ │"
MESSAGE " │ 1- ATLANTA │"
MESSAGE " │ 2- BOSTON │"
MESSAGE " │ 3- DALLAS │"
MESSAGE " │ 4- DENVER │"
MESSAGE " │ 5- DETROIT │"
MESSAGE " │ 6- HOUSTON │"
MESSAGE " │ 7- LOS ANGELES │"
MESSAGE " │ 8- NEWARK │"
MESSAGE " │ 9- NEW YORK │"
MESSAGE " │ 10- PHILADELPHIA │"
MESSAGE " │ 11- SAN FRANCISCO │"
MESSAGE " │ 12- SEATTLE │"
MESSAGE " │ 13- WASHINGTON, DC │"
MESSAGE " ├───────────────────────────────┤"
MESSAGE " │ ENTER THE # OF THE CITY OF │"
MESSAGE " │ YOUR CHOICE: │"
MESSAGE " └───────────────────────────────┘"
L1: ; label for use by default case
LOCATE 18,38 ; position cursor
MESSAGE " " ; clear prompt area
LOCATE 18,38 ; reposition cursor
GET S0 2 ; get users choice
SWITCH S0 ; switch on choice
CASE "1" ; chose ATLANTA
ASSIGN S1 "ATLANTA" ; save the city name
ASSIGN S2 "404" ; save the area code
GOSUB ATLANTA ; go get number to dial
ENDCASE
CASE "5" ; chose DETROIT
ASSIGN S1 "DETROIT" ; save the city name
ASSIGN S2 "313" ; save the area code
GOSUB DETROIT ; go get number to dial
ENDCASE
CASE "13" ; chose WASHINGTON DC
ASSIGN S1 "WASHINGTON, DC" ; save the city name
ASSIGN S2 "202" ; save the area code
GOSUB WASHINGTON_DC ; go get number to dial
ENDCASE
DEFAULT ; all other cases
LOCATE 22,24
MESSAGE "^G" ; error noise
LOCATE 22,24
MESSAGE "Not yet implemented in this demo"
LOCATE 22,24
PAUSE 2
MESSAGE " "
GOTO L1
ENDCASE
ENDSWITCH
;
; Ok, call the local TELENET number first. This is an example of
; redialing without using the DIAL or Alt-R commands
;
CLEAR ; ready to call TELENET
SET PARITY EVEN ; set parms for TELENET
SET DATABITS 7
MESSAGE "DIALING PCP" ; let em know whats happening
LOCATE 0,12
MESSAGE S1 ; include city in message
L2: ; label for busy TELENET
TRANSMIT S6 ; call local Telenet
WAITFOR "CONNECT" 15 ; give it 15 seconds to answer
IF NOT WAITFOR ; it didn't connect, assume busy
CLEAR ; example of redialing without Alt-R
HANGUP
MESSAGE "PCP TELENET IS BUSY. REDIALING..."
GOTO L2
ENDIF
;
; Ok, made it to local telenet number, now call the remote PCP city
; Notice that we redial at this point as well
;
PAUSE 2
TRANSMIT "^m^m" ; Get Telenet's attention
WAITFOR "=" ; Wait for 'TERMINAL=' prompt
TRANSMIT "D1!" ; Enter terminal type
WAITFOR "@" ; Wait for Telenet prompt
L3: ; label for busy remote PCP city
TRANSMIT "C DIAL"
TRANSMIT S2 ; area code
TRANSMIT "/"
TRANSMIT S9 ; BAUD RATE
TRANSMIT ","
TRANSMIT S8 ; ID
TRANSMIT "!" ; cr
WAITFOR "=" ; Wait for 'PASSWORD=' prompt
TRANSMIT S7 ; Enter password
TRANSMIT "!" ; cr
RGET S5 ; Get the CR echoed from our TRANSMIT
RGET S5 ; Get the CR that precedes PCP messages
RGET S5 ; Get the actual message
PAUSE 1 ; Display it briefly
FIND S5 "CONNECT" ; Look for connection
IF NOT FOUND ; No connection
CLEAR
MESSAGE "THE REMOTE PCP IS BUSY. REDIALING..." S1
LOCATE 1 0
GOTO L3
ENDIF
;
; Ok, made it to the remote PCP city. Display appropriate message
; then call the actual destination, again using a redial
;
CLEAR
MESSAGE "CONNECTED TO PCP"
LOCATE 0,17
MESSAGE S1
LOCATE 1,0
MESSAGE "DIALING"
LOCATE 1,8
MESSAGE S3
L4: ; label for busy number
LOCATE 2 0
TRANSMIT "ATZ!" ; Wake up remote modem
WAITFOR "OK" ; Wait for 'OK' prompt
TRANSMIT "ATDT"
TRANSMIT S4 ; THE NUMBER
TRANSMIT "!" ; CR
RGET S0 ; Get CR echoed from our TRANSMIT
RGET S0 80 40 ; Get CR that precedes PCP messages
RGET S0 ; Get the real message
PAUSE 2
FIND S0 "BUSY" ; was it busy?
IF FOUND
CLEAR
MESSAGE "BUSY. REDIALING..." S3
GOTO L4
ENDIF
FIND S0 "CONNECT" ; did it connect?
IF FOUND
SET PARITY NONE ; Switch to N/8/1 for BBS work
SET DATABITS 8
CLEAR
MESSAGE "CONNECTED TO"
LOCATE 0,13
MESSAGE S3
LOCATE 1,0
MESSAGE "LOGON PRECEEDING"
ELSE ; not busy or connect, assume error
CLEAR
MESSAGE "NO CONNECT OR BUSY. REDIALING"
GOTO L4
ENDIF
ALARM 2 ; sound alarm for 2 seconds
EXIT ; we made it!
;********************************************************************
;
; SUBROUTINES START HERE
;
; note that you could put these at the beginning of the file, and
; initially branch around them. As each GOSUB and GOTO starts looking
; at the top of the file, it would speed up some parts of the process,
; while slowing down others. Maybe next time we'll build a symbol table
; and eliminate this inefficiency.
;
;**************************************